﻿$(document).on("pageInit", "#my-class-list", function (e, id, page) {
    loadList();

    function loadList() {
        $(page).find("#list").empty();
        $.getJSON("/ClazzInfo/GetList", {}, function (response) {
            $.each(response, function (index, item) {
                var frame = $('<li class="item-content item-link"><div class="item-media"><i class="icon icon-f7"></i></div><a data-no-cache="true" href="/ClazzInfo/info/' + item.ClazzId + '" class="item-inner"><div class="item-title">' + item.ClazzName + '</div></a> </li>');
                $(page).find("#list").append(frame);
            });
        });
    }

    $(page).find("#menu-btn").on("click", function () {
        var buttons1 = [
        {
            text: '请选择',
            label: true
        },
        {
            text: '创建班级',
            bold: true,
            onClick: function () {
                $.router.load('/clazzinfo/createclass', true);
            }
        }];

        var buttons2 = [
          {
              text: '取消',
              bg: 'danger'
          }
        ];
        var groups = [buttons1, buttons2];
        $.actions(groups);
    });
});